package com.nononsenseapps.feeder.ui.common

import android.content.Context
import android.graphics.Color
import android.util.AttributeSet
import android.view.MotionEvent
import androidx.drawerlayout.widget.DrawerLayout

class PadDrawerLayout @JvmOverloads constructor(
        context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : DrawerLayout(context, attrs, defStyleAttr) {

    init {
        setScrimColor(Color.TRANSPARENT)
    }

    var interruptTouchEventDisableCheck: ((Float, Float) -> Boolean)? =null

    override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
        if(interruptTouchEventDisableCheck!=null&&interruptTouchEventDisableCheck!!.invoke(ev!!.rawX,ev.rawY))
            return false
        return super.onInterceptTouchEvent(ev)
    }
}